/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CloseablePanel.java
 *
 * Created on 8/Dez/2011, 20:50:25
 */

package intopo.evogame.partnerselection.tools.config;

import java.awt.BorderLayout;
import java.awt.Component;

/**
 * A container that can be hide or show its content.
 * 
 * @author <a href="mailto:mariano.pedro@gmail.com">Pedro Mariano</a>
 *
 * @version 1.0 8/Dez/2011
 */
public class CloseablePanel
	extends javax.swing.JPanel
{

	/** Creates new form CloseablePanel */
	public CloseablePanel ()
	{
		initComponents ();
	}
	public CloseablePanel (Component c)
	{
		initComponents ();
		this.add (c, java.awt.BorderLayout.CENTER);
	}

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
   // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   private void initComponents() {

      closeButton = new javax.swing.JButton();

      setLayout(new java.awt.BorderLayout());

      closeButton.setText("<");
      closeButton.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            closeButtonActionPerformed(evt);
         }
      });
      add(closeButton, java.awt.BorderLayout.EAST);
   }// </editor-fold>//GEN-END:initComponents

	 private void closeButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
		BorderLayout bl = (BorderLayout) this.getLayout ();
		Component c = bl.getLayoutComponent (this, BorderLayout.CENTER);
		c.setVisible (!c.isVisible ());
	 }//GEN-LAST:event_closeButtonActionPerformed


   // Variables declaration - do not modify//GEN-BEGIN:variables
   private javax.swing.JButton closeButton;
   // End of variables declaration//GEN-END:variables

}

// Local Variables:
// mode: java
// mode: flyspell-prog
// ispell-local-dictionary: "british"
// End:
